package com.it.mybytestream;

import java.io.FileOutputStream;
import java.io.IOException;

public class ByteStreamDemo2 {
    public static void main(String[] args) throws IOException {
        //1.创建对象
        FileOutputStream fos = new FileOutputStream("D:\\java\\basic-code\\myio\\src\\b.txt");

        //2.输入数据
        String str = "hahaxixi";
        byte[] byte1 = str.getBytes();
        fos.write(byte1);
        //换行符
        String wrap = "\r\n";
        byte[] byte3 = wrap.getBytes();
        fos.write(byte3);

        String str2 = "111";
        byte[] byte2 = str2.getBytes();
        fos.write(byte2);
        //3,释放资源
        fos.close();
    }
}
